package tech.ezrealc.fall2023.controller.affair;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.ezrealc.fall2023.model.affair.department.mapper.DepartmentMapper;
import tech.ezrealc.fall2023.model.common.ResponseModel;
import tech.ezrealc.fall2023.service.affair.department.DepartmentService;

@RestController
@RequestMapping("/api/affair/department")
@CrossOrigin
public class DepartmentController {

    @Resource
    private DepartmentService departmentService;

    @Resource
    private DepartmentMapper departmentMapper;

    @GetMapping
    public ResponseModel query() {
        return ResponseModel.success(departmentMapper.toVOList(departmentService.queryAll()));
    }

}
